package com.human.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import com.human.entity.Emptrain;
import com.human.entity.ResultVo;
import com.human.service.IEmptrainService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 员工培训 前端控制器
 * </p>
 *
 * @author jzq
 * @since 2023-03-09
 */
@RestController
@RequestMapping("/api/emptrain")
@Api(tags = "培训管理")
@ApiSupport(order = 6)
public class EmptrainController {

    @Autowired
    IEmptrainService emptrainService;

    @PostMapping("/page")
    @ApiOperation(value = "员工培训分页查询")
    public ResultVo<Page> page(int current, int pageSize, String name) {
        return emptrainService.page(current,pageSize,name);
    }

    @GetMapping("/{id}")
    @ApiOperation(value = "根据ID查询培训")
    public ResultVo getEmptrainById(@PathVariable("id") Integer id) {
        return emptrainService.getEmptrainById(id);
    }

    @GetMapping("/emptrainList")
    @ApiOperation(value = "查询所有培训")
    public ResultVo getAllEmptrains() {
        return emptrainService.getAllEmptrains();
    }

    @PostMapping("/addEmptrain")
    @ApiOperation(value = "添加培训")
    public ResultVo addEmptrain(@RequestBody Emptrain emptrain) {
        return emptrainService.addEmptrain(emptrain);
    }

    @PutMapping("/updateEmptrain")
    @ApiOperation(value = "修改培训")
    public ResultVo updateEmptrain(@RequestBody Emptrain emptrain) {
        return emptrainService.updateEmptrain(emptrain);
    }

    @DeleteMapping("/{id}")
    @ApiOperation(value = "删除培训")
    public ResultVo deleteEmptrainById(@PathVariable("id") Integer id) {
        return emptrainService.deleteEmptrainById(id);
    }


}

